package com.mercury.ec.framework.air.core.client.impl.sunstn.dto.rt;

import com.mercury.ec.framework.air.core.client.impl.sunstn.jaxb.adapter.Boolean2XmlAdapter;
import com.mercury.ec.framework.air.core.client.impl.sunstn.jaxb.adapter.DecodeHex2XmlAdapter;
import com.mercury.ec.framework.air.core.client.impl.sunstn.jaxb.adapter.LocalEnglishDate2XmlAdapter;
import com.mercury.ec.framework.air.core.client.impl.sunstn.jaxb.adapter.TimeAddColon2XmlAdapter;
import lombok.Data;

import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.time.LocalDate;
import java.util.List;

/**
 * SUNSTN RT Response DTO
 *
 * @author hesx
 */
@Data
@XmlRootElement(name = "rt_parse")
@XmlAccessorType(XmlAccessType.FIELD)
public class SunstnRtRespDTO {
    /**
     * 编码提取结果，如果为 0，则表示该次请求失败
     */
    @XmlAttribute(name = "ret_value")
    @XmlJavaTypeAdapter(Boolean2XmlAdapter.class)
    private Boolean ret_value;

    /**
     * 错语信息
     */
    @XmlAttribute(name = "err_info")
    private String err_info;

    /**
     * 预订记录 C 系统编码
     */
    private String pnr;

    /**
     * 预订记录 B 系统编码
     */
    private String b_pnr;

    /**
     * 是否为团队编码
     */
    @XmlJavaTypeAdapter(Boolean2XmlAdapter.class)
    private Boolean is_team;

    /**
     *
     */
    @XmlJavaTypeAdapter(Boolean2XmlAdapter.class)
    private Boolean team_pc;

    /**
     * 编码中是否包含证件信息（提取其他 office 号编码，获取不到证件号，只能判断是否有证件号）
     */
    @XmlJavaTypeAdapter(Boolean2XmlAdapter.class)
    private Boolean HasNI;

    /**
     *
     */
    @XmlJavaTypeAdapter(Boolean2XmlAdapter.class)
    private Boolean HasINF;

    /**
     *
     */
    @XmlJavaTypeAdapter(Boolean2XmlAdapter.class)
    private Boolean IsCHD;

    /**
     * RMK项
     */
    private String remark;

    /**
     * osi项
     */
    private String osi;

    /**
     *
     */
    private String tl;

    /**
     *
     */
    private String tl_date;

    /**
     *
     */
    private String tl_time;

    /**
     * 出票日期
     */
    @XmlJavaTypeAdapter(LocalEnglishDate2XmlAdapter.class)
    private LocalDate tk_date;

    /**
     * 出票时限
     */
    @XmlJavaTypeAdapter(TimeAddColon2XmlAdapter.class)
    private String tk_time;

    /**
     * 原文
     */
    @XmlJavaTypeAdapter(DecodeHex2XmlAdapter.class)
    private String raw_data;

    /**
     * pat原文
     */
    @XmlJavaTypeAdapter(DecodeHex2XmlAdapter.class)
    private String pat_data;

    /**
     * 行程列表
     */
    @XmlElementWrapper(name = "lines")
    @XmlElement(name = "Line", type = SunstnRtLineRespDTO.class)
    private List<SunstnRtLineRespDTO> lines;

    /**
     * 乘客列表
     */
    @XmlElementWrapper(name = "passengers")
    @XmlElement(name = "passenger", type = SunstnRtPassengerRespDTO.class)
    private List<SunstnRtPassengerRespDTO> passengers;

    /**
     * 票号列表
     */
    @XmlElementWrapper(name = "tickets")
    @XmlElement(name = "ticket", type = String.class)
    private List<String> tickets;

    /**
     * 价格列表
     */
    @XmlElementWrapper(name = "prices")
    @XmlElement(name = "price", type = SunstnRtPriceRespDTO.class)
    private List<SunstnRtPriceRespDTO> prices;
}
